# _*_ coding:utf-8 _*_
# @Time : 2023/2/2 14:22
# @Author : wsl
# @File : day08_Stu
# @Project : python
class Stu:
    def __init__(self, name, yw, sx, en):
        self.name = name
        self.yw = yw
        self.sx = sx
        self.en = en

    def score_sum(self):
        return self.yw + self.en + self.sx

    def print_score(self):
        msg = "{name}的各科成绩:" \
              "语文：{yw}," \
              "数学：{sx}," \
              "英语：{en}".format(name=self.name,
                               yw=self.yw,
                               sx=self.sx,
                               en=self.en)
        print(msg)
        msg = "{name}的总成绩:{sum}".format(name=self.name, sum=self.score_sum())
        print(msg)


students = []
with open('input/test.txt', 'r', encoding='utf-8') as file:
    lines = file.readlines()
    for i in range(0, len(lines)):
        line = lines[i]
        arr = line.split()
        s = Stu(arr[0], int(arr[1]), int(arr[2]), int(arr[3]))
        students.append(s)

for stu in students:
    stu.print_score()
